// PoseableObject.h - An object which has both position and rotation.
// Cameras and directional lights are both direct subclasses.
//
// Nick Kitten
// 2009

#pragma once

#include "DarkGDK.h"
#include "Object.h"

class PoseableObject : public Object
{
public:
	PoseableObject();
	PoseableObject( int id, float x = 0, float y = 0, float z = 0, float rx = 0, float ry = 0, float rz = 0 );
	PoseableObject( int id, Triple pos, Triple rot ) { PoseableObject( id, pos.x, pos.y, pos.z, rot.x, rot.y, rot.z ); }
	virtual ~PoseableObject();

	Triple getRotation() const;			// return a copy of the object's orientation
	float getRotX() const;					// return the x coordinate of the rotation
	float getRotY() const;					// return the y coordinate of the rotation
	float getRotZ() const;					// return the z coordinate of the rotation

	virtual void setRotation(float x, float y, float z);		// set the object's current orientation
	void setRotation( Triple rot ) { setRotation( rot.x, rot.y, rot.z ); }

	void constrainToRotation( PoseableObject * child, string axes = "xyz" );
	bool removeRotationConstraint( PoseableObject * child, string axes = "xyz" );

protected:
	Triple rotation;

	// Used for applying transformations from one object to any number of children
	typedef struct RotationConstraint
	{
		PoseableObject * obj;
		std::set<char> axes;
	} RotationConstraint;

	list< RotationConstraint > rotationChildren;
};


